import rclpy
from rclpy.node import Node
from std_msgs.msg import String,UInt32
from sensor_msgs.msg import Image

import time

def call(massage):
    print(massage.data)

def main (args=None):

    rclpy.init(args=args)#初始化rclpy
    node=Node("qrr")#新建一个节点
    # node.pub_novel=node.create_publisher(String,'image_raw',10)
    node.sub_novel=node.create_subscription(String,"QR_Code_Content",call,10)
    node.sub_image=node.create_subscription(Image,"camera/image_raw",call,10)
    # massage=String()
    # massage.data=("give me the result of qr..")
    # num=0
    # while(1):
    #     node.pub_novel.publish(massage)
    #     node.get_logger().info("send message of {0}...".format(num))
    #     num+=1
    #     time.sleep(1)

    rclpy.spin(node)#保持节点运行 检测是否收到退出指令  （Ctrl+c）
    rclpy.shutdown()#关闭rclpy